(function($){
    function setRefund(){
        $('.but_set_refund').on('click', function(){
            var obj = $(this);
            var id = obj.attr('did');
            var url = obj.attr('durl');
            var info = '退款成功';
            layer.confirm(
                '确定要设置此订单【' + info + '】吗？',
                {
                    icon: 3,
                    title: '系统提示',
                    btn: ['确 定', '取 消']
                },
                function(index){
                    layer.close(index);
                    layer.load();
                    $.post(
                        url,
                        {id: id},
                        function(data){
                            if(data.status == 10000) {
                                layer.alert('设置成功！', function(){
                                    location.reload(true);
                                });
                            } else {
                                layer.closeAll();
                                layer.alert(data.errmsg);
                            }
                        },
                        'json'
                    );
                },
                function(index){
                    layer.close(index);
                }
            );
        });
    }
    $(function(){
        setRefund();
        $('.input-daterange').datepicker({
            language: "zh-CN",
            autoclose: true,
            todayHighlight: true,
            format: "yyyy-mm-dd"
        });

    });
})(jQuery);